Conditions | 1 |
Total Lines | 14 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Inject, Injectable } from '@nestjs/common'; |
||
11 | |||
12 | public toCsv(table: Table): string { |
||
13 | const header = table.columns.map(column => |
||
14 | this.translator.translate(column.toString()) |
||
15 | ); |
||
16 | const rows = table.rows.map(row => |
||
17 | row |
||
18 | .map(cell => { |
||
19 | const text = cell.renderText(); |
||
20 | return `"${text}"`; // Use quotes to allow newlines |
||
21 | }) |
||
22 | .join(';') |
||
23 | ); |
||
24 | return [header.join(';'), ...rows].join('\n'); |
||
25 | } |
||
27 |